home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-09-30 | 13.5 KB | 442 lines | [TEXT/MPS ] |
- /*------------------------------------------------------------------------------
- #
- # Apple Macintosh Developer Technical Support
- #
- # BitMap Transformer
- #
- # Transformer.r - Rez Source
- #
- # Copyright © 1989 Apple Computer, Inc.
- # All rights reserved.
- #
- # Versions:
- # 1.0 10/89
- #
- # Components:
- # MTransformer.p October 1, 1989
- # UTransformer.p October 1, 1989
- # UTransformer.inc1.p October 1, 1989
- # Transformer.c October 1, 1989
- # Transformer.r October 1, 1989
- # Transformer.MAMake October 1, 1989
- # ProjInit October 1, 1989
- # The BitMap Transmogrifier October 1, 1989
- #
- # Requirements:
- # MacApp® 2.0ß9 July 10, 1989
- #
- # "Transformers" is a sample program that demonstrates how to translate,
- # rotate, and scale bitmaps. It uses a MacApp shell to open file, open
- # windows, and handle menus, but the core routine is written in vanilla C.
- #
- ------------------------------------------------------------------------------*/
-
-
- // • Auto-Include the requirements for this source
- #ifndef __TYPES.R__
- #include "Types.r"
- #endif
-
- #ifndef __SYSTYPES.R__
- #include "SysTypes.r"
- #endif __SYSTYPES.R__
-
- #ifndef __MacAppTypes__
- #include "MacAppTypes.r"
- #endif
-
- #if qTemplateViews
- #ifndef __ViewTypes__
- #include "ViewTypes.r"
- #endif
- #endif
-
-
- // Get the application's CODE. Note that this is done this way so that the application can
- // be linked and/or rezzed separately. Also, Rez currently (MPW 3.0) does not support
- // -align longword simultaneously with the -append option (but it only tells you if you're
- // getting -p progress indication).
- include $$Shell("ObjApp")$$Shell("XAppName") 'CODE';
-
- // Basic resources for various purposes.
- // Self evident from their names!
- include "MacApp.rsrc";
- include "Dialog.rsrc";
- // include "Printing.rsrc";
-
- #if qDebug
- include "Debug.rsrc";
- #endif
-
-
- // Now include the "default" resources
- // Note: you can pick and choose to selectively replace defaults in your own Rez source.
- // #if qTemplateViews
- // include "Defaults.rsrc" 'view' (kDefaultViewID);
- // include "Defaults.rsrc" 'view' (kDefaultWindowID);
- // #endif
-
- include "Defaults.rsrc" 'ALRT' (phAboutApp);
- include "Defaults.rsrc" 'cmnu' (128); // Buzzwords
- include "Defaults.rsrc" 'cmnu' (mApple);
- include "Defaults.rsrc" 'cmnu' (mEdit);
- // include "Defaults.rsrc" 'cmnu' (mFile);
- include "Defaults.rsrc" 'DITL' (phAboutApp);
- // include "Defaults.rsrc" 'MBAR' (kMBarDisplayed);
- // include "Defaults.rsrc" 'SIZE' (-1);
- include "Defaults.rsrc" 'STR#' (kDefaultCredits);
- include "Defaults.rsrc" 'WIND' (kDefaultWindowID);
-
- // Get the default MacApp® application icon and necessary bundling rsrcs
- include "Defaults.rsrc" 'MApp' (0);
- include "Defaults.rsrc" 'FREF' (128);
- include "Defaults.rsrc" 'BNDL' (128);
- include "Defaults.rsrc" 'ICN#' (128);
-
- // Get the default Version resources
- // include "Defaults.rsrc" 'vers' (1); // Application or file specific
- include "Defaults.rsrc" 'vers' (2); // Overall package
-
- /*--------------------------------------------------------------------------------
- The revision of this particular file
- --------------------------------------------------------------------------------*/
- RESOURCE 'vers' (1, purgeable) {
- 0x01,
- 0x00,
- final,
- 0x01,
- verUs,
- "1.0",
- "Transformer 1.0, Macintosh Developer Technical Support, © Apple Computer, Inc. 1989"
- };
-
-
- // *****************************************************************************
- //
- // My own custom stuff (windows, menus, you know?)
- //
-
- #define kOptionsDialog 1100
-
- #define mTransform 4
- #define cNormal 1000
- #define cRot90 1001
- #define cRot45 1002
- #define cScale2 1003
- #define cScaleHalf 1004
- #define cRot45ScaleHalf 1005
- #define cCustom 1006
-
- resource 'cmnu' (mFile,
- #if qNames
- "mFile",
- #endif
- nonpurgeable) {
- mFile,
- textMenuProc,
- 0x7FFFFFFD,
- enabled,
- "File",
- {
- "Open…", noIcon, "O", noMark, plain, cOpen;
- "Close", noIcon, "W", noMark, plain, cClose;
- "-", noIcon, noKey, noMark, plain, nocommand;
- "Quit", noIcon, "Q", noMark, plain, cQuit
- }
- };
-
-
- resource 'cmnu' (mTransform,
- #if qNames
- "mTransform",
- #endif
- nonpurgeable) {
- mTransform,
- textMenuProc,
- 0x7FFFFFFD,
- enabled,
- "Transform",
- {
- "Display Normally", noIcon, noKey, noMark, plain, cNormal;
- "-", noIcon, noKey, noMark, plain, nocommand;
- "Rotate 90", noIcon, noKey, noMark, plain, cRot90;
- "Rotate 45", noIcon, noKey, noMark, plain, cRot45;
- "Scale Double", noIcon, noKey, noMark, plain, cScale2;
- "Scale Half", noIcon, noKey, noMark, plain, cScaleHalf;
- "Rotate 45 Scale Half", noIcon, noKey, noMark, plain, cRot45ScaleHalf;
- "-", noIcon, noKey, noMark, plain, nocommand;
- "Custom…", noIcon, "T", noMark, plain, cCustom;
- }
- };
-
-
- resource 'MBAR' (kMBarDisplayed,
- #if qNames
- "kMBarDisplayed",
- #endif
- nonpurgeable) {
-
- {mApple; mFile; mEdit; mTransform}
- };
-
- resource 'SIZE' (-1) {
- saveScreen,
- acceptSuspendResumeEvents,
- enableOptionSwitch,
- canBackground,
- MultiFinderAware,
- backgroundAndForeground,
- dontGetFrontClicks,
- ignoreChildDiedEvents,
- is32BitCompatible,
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- #if qDebug
- 410 * 1024,
- 410 * 1024
- #else
- 330 * 1024,
- 220 * 1024
- #endif
- };
-
- resource 'seg!' (256,
- #if qNames
- "TransformerSeg!",
- #endif
- purgeable) {
- {
- "GOpen";
- "GFile";
- "GSelCommand";
- }
- };
-
-
-
- #if qTemplateViews
- resource 'view' (kDefaultWindowID,
- #if qNames
- "kDefaultWindowID",
- #endif
- purgeable) {
- {
- root, 'WIND', { 50, 20 }, { 260, 430 }, sizeVariable, sizeVariable, shown, enabled,
- Window { "", zoomDocProc, goAwayBox, resizable, modeless,
- ignoreFirstClick,
- freeOnClosing, disposeOnFree, closesDocument, openWithDocument, dontAdaptToScreen,
- stagger, forceOnScreen, dontCenter, 'DFLT', "" };
-
- 'WIND', 'SCLR', { 0, 0 }, { 260-kSBarSizeMinus1, 430-kSBarSizeMinus1 },
- sizeRelSuperView, sizeRelSuperView, shown, enabled,
- Scroller { "", vertScrollBar, horzScrollBar, 0, 0, 16, 16,
- vertConstrain, horzConstrain, { 0, 0, 0, 0 } };
-
- 'SCLR',IncludeViews { kDefaultViewID }
- }
- };
-
- resource 'view' (kDefaultViewID,
- #if qNames
- "kDefaultViewID",
- #endif
- purgeable) {
- {
- root, 'DFLT', { 0, 0 }, { 720, 576 }, sizeFixed, sizeFixed, shown, enabled,
- DefaultView {""} // A ClassName can be put in this string
- // or do a RegisterStdType to point to
- // something to create for a "Default View"
- }
- };
-
-
- resource 'view' (kOptionsDialog,
- #if qNames
- "kOptionsDialog",
- #endif
- purgeable) {
- {
- root, 'wind',
- { 50, 40 }, { 256, 336 }, sizeVariable, sizeVariable, shown, enabled,
- Window { "TWindow", dBoxProc, noGoAwayBox, notResizable, modal, ignoreFirstClick,
- freeOnClosing, disposeOnFree, doesntCloseDocument, openWithDocument, dontAdaptToScreen,
- dontStagger, dontForceOnScreen, center, 'ndeg', "<<<>>>" },
-
- 'wind', 'DLOG',
- { 0, 0 }, { 256, 336 }, sizeSuperView, sizeSuperView, shown, enabled,
- DialogView { "TDialogView", 'OKOK', 'CANC' },
-
- 'DLOG', noid,
- { 10, 16 }, { 16, 304 }, sizeFixed, sizeFixed, shown, disabled,
- StaticText { "TStaticText", adnLineBottom, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {0, 0, 0, 0}, plain, 14, { 0x0, 0x0, 0x0 }, "New York", justCenter,
- "Options" },
-
- 'DLOG', noid,
- { 48, 16 }, { 16, 144 }, sizeFixed, sizeFixed, shown, disabled,
- StaticText { "TStaticText", adnNone, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {0, 0, 0, 0}, plain, 0, { 0x0, 0x0, 0x0 }, "", justRight,
- "Amount of Rotation:" },
-
- 'DLOG', noid,
- { 80, 16 }, { 16, 144 }, sizeFixed, sizeFixed, shown, disabled,
- StaticText { "TStaticText", adnNone, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {0, 0, 0, 0}, plain, 0, { 0x0, 0x0, 0x0 }, "", justRight,
- "Amount of Scaling:" },
-
- 'DLOG', noid,
- { 112, 16 }, { 16, 144 }, sizeFixed, sizeFixed, shown, disabled,
- StaticText { "TStaticText", adnNone, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {0, 0, 0, 0}, plain, 0, { 0x0, 0x0, 0x0 }, "", justRight,
- "Center of Rotation:" },
-
- 'DLOG', noid,
- { 144, 16 }, { 16, 144 }, sizeFixed, sizeFixed, shown, disabled,
- StaticText { "TStaticText", adnNone, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {0, 0, 0, 0}, plain, 0, { 0x0, 0x0, 0x0 }, "", justRight,
- "Translation of Center:" },
-
- 'DLOG', noid,
- { 48, 256 }, { 16, 64 }, sizeFixed, sizeFixed, shown, disabled,
- StaticText { "TStaticText", adnNone, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {0, 0, 0, 0}, plain, 0, { 0x0, 0x0, 0x0 }, "", justLeft,
- "degrees" },
-
- 'DLOG', noid,
- { 80, 176 }, { 16, 16 }, sizeFixed, sizeFixed, shown, disabled,
- StaticText { "TStaticText", adnNone, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {0, 0, 0, 0}, plain, 0, { 0x0, 0x0, 0x0 }, "", justLeft,
- "X:" },
-
- 'DLOG', noid,
- { 112, 176 }, { 16, 16 }, sizeFixed, sizeFixed, shown, disabled,
- StaticText { "TStaticText", adnNone, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {0, 0, 0, 0}, plain, 0, { 0x0, 0x0, 0x0 }, "", justLeft,
- "X:" },
-
- 'DLOG', noid,
- { 144, 176 }, { 16, 16 }, sizeFixed, sizeFixed, shown, disabled,
- StaticText { "TStaticText", adnNone, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {0, 0, 0, 0}, plain, 0, { 0x0, 0x0, 0x0 }, "", justLeft,
- "X:" },
-
- 'DLOG', noid,
- { 80, 256 }, { 16, 16 }, sizeFixed, sizeFixed, shown, disabled,
- StaticText { "TStaticText", adnNone, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {0, 0, 0, 0}, plain, 0, { 0x0, 0x0, 0x0 }, "", justLeft,
- "Y:" },
-
- 'DLOG', noid,
- { 112, 256 }, { 16, 16 }, sizeFixed, sizeFixed, shown, disabled,
- StaticText { "TStaticText", adnNone, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {0, 0, 0, 0}, plain, 0, { 0x0, 0x0, 0x0 }, "", justLeft,
- "Y:" },
-
- 'DLOG', noid,
- { 144, 256 }, { 16, 16 }, sizeFixed, sizeFixed, shown, disabled,
- StaticText { "TStaticText", adnNone, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {0, 0, 0, 0}, plain, 0, { 0x0, 0x0, 0x0 }, "", justLeft,
- "Y:" },
-
- 'DLOG', 'ndeg',
- { 46, 192 }, { 20, 48 }, sizeFixed, sizeFixed, shown, enabled,
- NumberText { "TNumberText", adnFrame, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {2, 2, 2, 2}, plain, 0, { 0x0, 0x0, 0x0 }, "", justLeft,
- "", unlimited, 0b11110000000000000000000100000000, 0, 0, 359 },
-
- 'DLOG', 'nscx',
- { 78, 192 }, { 20, 48 }, sizeFixed, sizeFixed, shown, enabled,
- NumberText { "TExtNumberText", adnFrame, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {2, 2, 2, 2}, plain, 0, { 0x0, 0x0, 0x0 }, "", justLeft,
- "", unlimited, 0b11110000000000000000000100000000, 1, 0, 100 },
-
- 'DLOG', 'nscy',
- { 78, 272 }, { 20, 48 }, sizeFixed, sizeFixed, shown, enabled,
- NumberText { "TExtNumberText", adnFrame, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {2, 2, 2, 2}, plain, 0, { 0x0, 0x0, 0x0 }, "", justLeft,
- "", unlimited, 0b11110000000000000000000100000000, 1, 0, 100 },
-
- 'DLOG', 'ncrx',
- { 110, 192 }, { 20, 48 }, sizeFixed, sizeFixed, shown, enabled,
- NumberText { "TNumberText", adnFrame, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {2, 2, 2, 2}, plain, 0, { 0x0, 0x0, 0x0 }, "", justLeft,
- "", unlimited, 0b11110000000000000000000100000000, 288, 0, 575 },
-
- 'DLOG', 'ncry',
- { 110, 272 }, { 20, 48 }, sizeFixed, sizeFixed, shown, enabled,
- NumberText { "TNumberText", adnFrame, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {2, 2, 2, 2}, plain, 0, { 0x0, 0x0, 0x0 }, "", justLeft,
- "", unlimited, 0b11110000000000000000000100000000, 360, 0, 719 },
-
- 'DLOG', 'ntrx',
- { 142, 192 }, { 20, 48 }, sizeFixed, sizeFixed, shown, enabled,
- NumberText { "TNumberText", adnFrame, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {2, 2, 2, 2}, plain, 0, { 0x0, 0x0, 0x0 }, "", justLeft,
- "", unlimited, 0b11110000000000000000000100000000, 288, 0, 575 },
-
- 'DLOG', 'ntry',
- { 142, 272 }, { 20, 48 }, sizeFixed, sizeFixed, shown, enabled,
- NumberText { "TNumberText", adnFrame, {1, 1}, sizeable, notDimmed, notHilited,
- doesntDismiss, {2, 2, 2, 2}, plain, 0, { 0x0, 0x0, 0x0 }, "", justLeft,
- "", unlimited, 0b11110000000000000000000100000000, 360, 0, 719 },
-
- 'DLOG', 'OKOK',
- { 188, 28 }, { 32, 104 }, sizeFixed, sizeFixed, shown, enabled,
- Button { "TButton", adnRRect, {3, 3}, sizeable, notDimmed, notHilited, dismisses,
- {4, 4, 4, 4}, plain, 0, { 0x0, 0x0, 0x0 }, "", "OK" },
-
- 'DLOG', 'CANC',
- { 192, 208 }, { 24, 96 }, sizeFixed, sizeFixed, shown, enabled,
- Button { "TButton", adnNone, {1, 1}, sizeable, notDimmed, notHilited, dismisses,
- {0, 0, 0, 0}, plain, 0, { 0x0, 0x0, 0x0 }, "", "Cancel" },
- }
- };
-
- #endif
-
-
- // Spinning cursor support
-
- data 'acur' (0, preload) {
- $"00 04 00 00 00 80 00 00 00 81 00 00 00 82 00 00" /* .....Ä...Å...Ç.. */
- $"00 83 00 00" /* .É.. */
- };
-
- resource 'CURS' (128, preload) {
- $"07 C0 1F 30 3F 08 7F 04 7F 04 FF 02 FF 02 FF FE"
- $"81 FE 81 FE 41 FC 41 FC 21 F8 19 F0 07 C0",
- $"07 C0 1F F0 3F F8 7F FC 7F FC FF FE FF FE FF FE"
- $"FF FE FF FE 7F FC 7F FC 3F F8 1F F0 07 C0",
- {7, 7}
- };
-
- resource 'CURS' (129, preload) {
- $"07 C0 1F F0 3F F8 5F F4 4F E4 87 C2 83 82 81 02"
- $"83 82 87 C2 4F E4 5F F4 3F F8 1F F0 07 C0",
- $"07 C0 1F F0 3F F8 7F FC 7F FC FF FE FF FE FF FE"
- $"FF FE FF FE 7F FC 7F FC 3F F8 1F F0 07 C0",
- {7, 7}
- };
-
- resource 'CURS' (130, preload) {
- $"07 C0 19 F0 21 F8 41 FC 41 FC 81 FE 81 FE FF FE"
- $"FF 02 FF 02 7F 04 7F 04 3F 08 1F 30 07 C0",
- $"07 C0 1F F0 3F F8 7F FC 7F FC FF FE FF FE FF FE"
- $"FF FE FF FE 7F FC 7F FC 3F F8 1F F0 07 C0",
- {7, 7}
- };
-
- resource 'CURS' (131, preload) {
- $"07 C0 18 30 20 08 70 1C 78 3C FC 7E FE FE FF FE"
- $"FE FE FC 7E 78 3C 70 1C 20 08 18 30 07 C0",
- $"07 C0 1F F0 3F F8 7F FC 7F FC FF FE FF FE FF FE"
- $"FF FE FF FE 7F FC 7F FC 3F F8 1F F0 07 C0",
- {7, 7}
- };
-
-